home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / aplictns / xscheme2 / part07 < prev   
Encoding:
Internet Message Format  |  1990-04-14  |  56.1 KB

  1. Path: xanth!cs.odu.edu!Amiga-Request
  2. From: Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v90i145: XScheme 0.20 - an object-oriented scheme, Part07/07
  5. Message-ID: <12215@xanth.cs.odu.edu>
  6. Date: 14 Apr 90 21:15:17 GMT
  7. Sender: tadguy@cs.odu.edu
  8. Reply-To: rusty@fe2o3.UUCP (Rusty Haddock)
  9. Lines: 2884
  10. Approved: tadguy@cs.odu.edu (Tad Guy)
  11. X-Mail-Submissions-To: Amiga@cs.odu.edu
  12. X-Post-Discussions-To: comp.sys.amiga
  13.  
  14. Submitted-by: rusty@fe2o3.UUCP (Rusty Haddock)
  15. Posting-number: Volume 90, Issue 145
  16. Archive-name: applications/xscheme-0.20/part07
  17.  
  18. #!/bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of archive 7 (of 7)."
  25. # Contents:  xscheme.doc
  26. # Wrapped by tadguy@xanth on Sat Apr 14 17:07:32 1990
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'xscheme.doc' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'xscheme.doc'\"
  30. else
  31. echo shar: Extracting \"'xscheme.doc'\" \(52550 characters\)
  32. sed "s/^X//" >'xscheme.doc' <<'END_OF_FILE'
  33. X
  34. X
  35. X
  36. X
  37. X
  38. X
  39. X                       XSCHEME: An Object-oriented Scheme
  40. X
  41. X                                  Version 0.17
  42. X
  43. X                                 March 2, 1989
  44. X
  45. X
  46. X                                       by
  47. X                               David Michael Betz
  48. X                                  P.O. Box 144
  49. X                             Peterborough, NH 03458
  50. X
  51. X                             (603) 924-4145 (home)
  52. X
  53. X                   Copyright (c) 1989, by David Michael Betz
  54. X                              All Rights Reserved
  55. X           Permission is granted for unrestricted non-commercial use
  56. X
  57. X
  58. X
  59. X
  60. X
  61. X
  62. X
  63. X
  64. X
  65. X
  66. X
  67. X
  68. X
  69. X
  70. X
  71. X
  72. X
  73. X
  74. X
  75. X
  76. X
  77. X
  78. X
  79. X
  80. X
  81. X
  82. X
  83. X
  84. X
  85. X
  86. X
  87. X
  88. X
  89. X
  90. X
  91. X
  92. X
  93. X
  94. X
  95. X
  96. X
  97. X
  98. X
  99. X
  100. X
  101. X
  102. X        XSCHEME                TABLE OF CONTENTS                  Page 2
  103. X
  104. X
  105. X        TABLE OF CONTENTS
  106. X
  107. X            TABLE OF CONTENTS..................................2
  108. X            INTRODUCTION.......................................3
  109. X            A NOTE FROM THE AUTHOR.............................4
  110. X            EXPRESSIONS........................................5
  111. X            BINDING FORMS.....................................10
  112. X            SEQUENCING........................................11
  113. X            DELAYED EVALUATION................................12
  114. X            ITERATION.........................................13
  115. X            DEFINITIONS.......................................14
  116. X            LIST FUNCTIONS....................................15
  117. X            DESTRUCTIVE LIST FUNCTIONS........................17
  118. X            SYMBOL FUNCTIONS..................................18
  119. X            VECTOR FUNCTIONS..................................19
  120. X            ARRAY FUNCTIONS...................................20
  121. X            CONVERSION FUNCTIONS..............................21
  122. X            TYPE PREDICATES...................................22
  123. X            EQUALITY PREDICATES...............................25
  124. X            ARITHMETIC FUNCTIONS..............................26
  125. X            NUMERIC COMPARISON FUNCTIONS......................29
  126. X            BITWISE LOGICAL FUNCTIONS.........................30
  127. X            STRING FUNCTIONS..................................31
  128. X            STRING COMPARISON FUNCTIONS.......................32
  129. X            CHARACTER COMPARISON FUNCTIONS....................33
  130. X            INPUT/OUTPUT FUNCTIONS............................34
  131. X            OUTPUT CONTROL FUNCTIONS..........................36
  132. X            FILE I/O FUNCTIONS................................37
  133. X            CONTROL FEATURES..................................39
  134. X            ENVIRONMENT FUNCTIONS.............................40
  135. X            UTILITY FUNCTIONS.................................41
  136. X            SYSTEM FUNCTIONS..................................42
  137. X            OBJECT REPRESENTATIONS............................43
  138. X
  139. X
  140. X
  141. X
  142. X
  143. X
  144. X
  145. X
  146. X
  147. X
  148. X
  149. X
  150. X
  151. X
  152. X
  153. X
  154. X
  155. X
  156. X
  157. X
  158. X
  159. X
  160. X
  161. X
  162. X
  163. X
  164. X
  165. X
  166. X
  167. X
  168. X        XSCHEME                   INTRODUCTION                    Page 3
  169. X
  170. X
  171. X        XScheme is an implementation of the Scheme programming language
  172. X        with extensions to support object-oriented programming.
  173. X
  174. X        There are currently implementations of XScheme running on the
  175. X        IBM-PC and clones under MS-DOS, on the Macintosh, the Atari-ST
  176. X        and the Amiga.  It is completely written in the programming
  177. X        language 'C' and is easily extended with user written built-in
  178. X        functions and classes.  It is available in source form to non-
  179. X        commercial users.
  180. X
  181. X        This document is a brief description of XScheme.  XScheme
  182. X        follows the "Revised^3 Report on the Algorithmic Language
  183. X        Scheme".  It assumes some knowledge of Scheme or LISP and some
  184. X        understanding of the concepts of object-oriented programming.
  185. X
  186. X        I recommend the book "Structure and Interpretation of Computer
  187. X        Programs" by Harold Abelson and Gerald Jay Sussman and published
  188. X        by The MIT Press and the McGraw-Hill Book Company for learning
  189. X        Scheme (and programming in general).  You might also find "The
  190. X        Scheme Programming Language" by R. Kent Dybvig and "The Little
  191. X        Lisper" by Daniel P. Friedman and Matthias Felleisen to be
  192. X        helpful.
  193. X
  194. X
  195. X
  196. X
  197. X
  198. X
  199. X
  200. X
  201. X
  202. X
  203. X
  204. X
  205. X
  206. X
  207. X
  208. X
  209. X
  210. X
  211. X
  212. X
  213. X
  214. X
  215. X
  216. X
  217. X
  218. X
  219. X
  220. X
  221. X
  222. X
  223. X
  224. X
  225. X
  226. X
  227. X
  228. X
  229. X
  230. X
  231. X
  232. X
  233. X
  234. X        XSCHEME              A NOTE FROM THE AUTHOR               Page 4
  235. X
  236. X
  237. X        A NOTE FROM THE AUTHOR
  238. X
  239. X        If you have any problems with XScheme, feel free to contact me
  240. X        for help or advice.  Please remember that since XScheme is
  241. X        available in source form in a high level language, many users
  242. X        have been making versions available on a variety of machines.
  243. X        If you call to report a problem with a specific version, I may
  244. X        not be able to help you if that version runs on a machine to
  245. X        which I don't have access.  Please have the version number of
  246. X        the version that you are running readily accessible before
  247. X        calling me.
  248. X
  249. X        If you find a bug in XScheme, first try to fix the bug yourself
  250. X        using the source code provided.  If you are successful in fixing
  251. X        the bug, send the bug report along with the fix to me.  If you
  252. X        don't have access to a C compiler or are unable to fix a bug,
  253. X        please send the bug report to me and I'll try to fix it.
  254. X
  255. X        Any suggestions for improvements will be welcomed.  Feel free to
  256. X        extend the language in whatever way suits your needs.  However,
  257. X        PLEASE DO NOT RELEASE ENHANCED VERSIONS WITHOUT CHECKING WITH ME
  258. X        FIRST!!  I would like to be the clearing house for new features
  259. X        added to XScheme.  If you want to add features for your own
  260. X        personal use, go ahead.  But, if you want to distribute your
  261. X        enhanced version, contact me first.
  262. X
  263. X
  264. X
  265. X
  266. X
  267. X
  268. X
  269. X
  270. X
  271. X
  272. X
  273. X
  274. X
  275. X
  276. X
  277. X
  278. X
  279. X
  280. X
  281. X
  282. X
  283. X
  284. X
  285. X
  286. X
  287. X
  288. X
  289. X
  290. X
  291. X
  292. X
  293. X
  294. X
  295. X
  296. X
  297. X
  298. X
  299. X
  300. X        XSCHEME                   EXPRESSIONS                     Page 5
  301. X
  302. X
  303. X        EXPRESSIONS
  304. X
  305. X        <variable>
  306. X
  307. X            An expression consisting of a variable is a variable
  308. X            reference.  The value of the variable reference is the value
  309. X            stored in the location to which the variable is bound.  It
  310. X            is an error to reference an unbound variable.
  311. X
  312. X        (QUOTE <datum>)
  313. X        '<datum>
  314. X
  315. X            (quote <datum>) evaluates to <datum>.  <Datum> may be any
  316. X            external representation of a Scheme object.  This notation
  317. X            is used to include literal constants in Scheme code.  (quote
  318. X            <datum>) may be abbreviated as '<datum>.  The two notations
  319. X            are equivalent in all respects.
  320. X
  321. X        <constant>
  322. X
  323. X            Numeric constants, string constants, character constants,
  324. X            and boolean constants evaluate "to themselves"; they need
  325. X            not be quoted.
  326. X
  327. X        (<operator> <operand>...)
  328. X
  329. X            A procedure call is written by simply enclosing in
  330. X            parentheses expressions for the procedure to be called and
  331. X            the arguments to be passed to it.  The operator and operand
  332. X            expressions are evaluated and the resulting procedure is
  333. X            passed the resulting arguments.
  334. X
  335. X        (<object> <selector> <operand>...)
  336. X
  337. X            A message sending form is written by enclosing in
  338. X            parentheses expressions for the receiving object, the
  339. X            message selector, and the arguments to be passed to the
  340. X            method.  The receiver, selector, and argument expressions
  341. X            are evaluated, the message selector is used to select an
  342. X            appropriate method to handle the message, and the resulting
  343. X            method is passed the resulting arguments.
  344. X
  345. X
  346. X
  347. X
  348. X
  349. X
  350. X
  351. X
  352. X
  353. X
  354. X
  355. X
  356. X
  357. X
  358. X
  359. X
  360. X
  361. X
  362. X
  363. X
  364. X
  365. X
  366. X        XSCHEME                   EXPRESSIONS                     Page 6
  367. X
  368. X
  369. X        (LAMBDA <formals> <body>)
  370. X
  371. X            <Formals> should be a formal argument list as described
  372. X            below, and <body>  should be a sequence of one or more
  373. X            expressions.  A lambda expression evaluates to a procedure.
  374. X            The environment in effect when the lambda expression is
  375. X            evaluated is remembered as part of the procedure.  When the
  376. X            procedure is later called with some actual arguments, the
  377. X            environment in which the lambda expression was evaluated
  378. X            will be extended by binding the variables in the formal
  379. X            argument list to fresh locations, the corresponding actual
  380. X            argument values will be stored in those locations, and the
  381. X            expressions in the body of the lambda expression will be
  382. X            evaluated sequentially in the extended environment.  The
  383. X            result of the last expression in the body will be returned
  384. X            as the result of the procedure call.
  385. X
  386. X            <Formals> should have the following form:
  387. X
  388. X                (<var>... [#!OPTIONAL <ovar>...] [. <rvar>])
  389. X              or
  390. X                (<var>... [#!OPTIONAL <ovar>...] [#!REST <rvar>])
  391. X
  392. X              where:
  393. X
  394. X                <var>    is a required argument
  395. X                <ovar>   is an optional argument
  396. X                <rvar>   is a "rest" argument
  397. X
  398. X            There are three parts to a <formals> list.  The first lists
  399. X            the required arguments of the procedure.  All calls to the
  400. X            procedure must supply values for each of the required
  401. X            arguments.  The second part lists the optional arguments of
  402. X            the procedure.  An optional argument may be supplied in a
  403. X            call or omitted.  If it is omitted, a special value is given
  404. X            to the argument that satisfies the default-object?
  405. X            predicate.  This provides a way to test to see if an
  406. X            optional argument was provided in a call or omitted.  The
  407. X            last part of the <formals> list gives the "rest" argument.
  408. X            This argument will be bound to the rest of the list of
  409. X            arguments supplied to a call after the required and optional
  410. X            arguments have been removed.
  411. X
  412. X
  413. X
  414. X
  415. X
  416. X
  417. X
  418. X
  419. X
  420. X
  421. X
  422. X
  423. X
  424. X
  425. X
  426. X
  427. X
  428. X
  429. X
  430. X
  431. X
  432. X        XSCHEME                   EXPRESSIONS                     Page 7
  433. X
  434. X
  435. X        (IF <test> <consequent> [<alternate>])
  436. X
  437. X            An if expression is evaluated as follows:  first, <test> is
  438. X            evaluated.  If it yields a true value, then <consequent> is
  439. X            evaluated and its value is returned.  Otherwise, <alternate>
  440. X            is evaluated and its value is returned.  If <test> yields a
  441. X            false value and no <alternate> is specified, then the result
  442. X            of the expression is unspecified.
  443. X
  444. X        (ACCESS <variable> <env>)
  445. X
  446. X            <Env> is evaluated producing an environment.  The result is
  447. X            the value of <variable> in this environment.
  448. X
  449. X        (SET! <variable> <expression>)
  450. X
  451. X            <Expression> is evaluated, and the resulting value is stored
  452. X            in the location to which <variable> is bound.  <Variable>
  453. X            must be bound in some region or at the top level. The result
  454. X            of the set! expression is unspecified.
  455. X
  456. X        (SET! (ACCESS <variable> <env>) <value>)
  457. X
  458. X            <Env> is evaluated producing an environment.  <Value> is
  459. X            evaluated and the resulting value is stored as the value of
  460. X            <variable> in this environment.  The result of the set!
  461. X            expression is unspecified.
  462. X
  463. X
  464. X
  465. X
  466. X
  467. X
  468. X
  469. X
  470. X
  471. X
  472. X
  473. X
  474. X
  475. X
  476. X
  477. X
  478. X
  479. X
  480. X
  481. X
  482. X
  483. X
  484. X
  485. X
  486. X
  487. X
  488. X
  489. X
  490. X
  491. X
  492. X
  493. X
  494. X
  495. X
  496. X
  497. X
  498. X        XSCHEME                   EXPRESSIONS                     Page 8
  499. X
  500. X
  501. X        (COND <clause>...)
  502. X
  503. X            Each clause should be of the form
  504. X
  505. X                (<test> <expression>...)
  506. X
  507. X            where <test> is any expression.  The last <clause> may be an
  508. X            "else clause," which has the form
  509. X
  510. X                (ELSE <expression>...)
  511. X
  512. X            A cond expression is evaluated by evaluating the <test>
  513. X            expressions of successive <clause>s in order until one of
  514. X            them evaluates to a true value.  When a <test> evaluates to
  515. X            a true value, then the remaining <expression>s in its
  516. X            <clause> are evaluated in order, and the result of the last
  517. X            <expression> in the <clause> is returned as the result of
  518. X            the entire cond expression.  If the selected <clause>
  519. X            contains only the <test> and no <expression>s, then the
  520. X            value of the <test> is returned as the result.  If all
  521. X            <test>s evaluate to false values, and there is no else
  522. X            clause, then the result of the conditional expression is
  523. X            unspecified; if there is an else clause, then its
  524. X            <expression>s are evaluated, and the value of the last one
  525. X            is returned.
  526. X
  527. X
  528. X
  529. X
  530. X
  531. X
  532. X
  533. X
  534. X
  535. X
  536. X
  537. X
  538. X
  539. X
  540. X
  541. X
  542. X
  543. X
  544. X
  545. X
  546. X
  547. X
  548. X
  549. X
  550. X
  551. X
  552. X
  553. X
  554. X
  555. X
  556. X
  557. X
  558. X
  559. X
  560. X
  561. X
  562. X
  563. X
  564. X        XSCHEME                   EXPRESSIONS                     Page 9
  565. X
  566. X
  567. X        (AND <test>...)
  568. X
  569. X            The <test> expressions are evaluated from left to right, and
  570. X            the value of the first expression that evaluates to a false
  571. X            value is returned.  Any remaining expressions are not
  572. X            evaluated.  If all the expressions evaluate to true values,
  573. X            the value of the last expression is returned.  If there are
  574. X            no expressions then #t is returned.
  575. X
  576. X        (OR <test>...)
  577. X
  578. X            The <test> expressions are evaluated from left to right, and
  579. X            the value of the first expression that evaluates to a true
  580. X            value is returned.  Any remaining expressions are not
  581. X            evaluated.  If all expressions evaluate to false values, the
  582. X            value of the last expression is returned.  If there are no
  583. X            expressions then #f is returned.
  584. X
  585. X
  586. X
  587. X
  588. X
  589. X
  590. X
  591. X
  592. X
  593. X
  594. X
  595. X
  596. X
  597. X
  598. X
  599. X
  600. X
  601. X
  602. X
  603. X
  604. X
  605. X
  606. X
  607. X
  608. X
  609. X
  610. X
  611. X
  612. X
  613. X
  614. X
  615. X
  616. X
  617. X
  618. X
  619. X
  620. X
  621. X
  622. X
  623. X
  624. X
  625. X
  626. X
  627. X
  628. X
  629. X
  630. X        XSCHEME                  BINDING FORMS                   Page 10
  631. X
  632. X
  633. X        BINDING FORMS
  634. X
  635. X        (LET [<name>] <bindings> <body>)
  636. X
  637. X            <Bindings> should have the form
  638. X
  639. X                ((<variable> <init>)...)
  640. X
  641. X            where each <init> is an expression, and <body> should be a
  642. X            sequence of one or more expressions.  The <init>s are
  643. X            evaluated in the current envirnoment, the <variable>s are
  644. X            bound to fresh locations holding the results, the <body> is
  645. X            evaluated in the extended environment, and the value of the
  646. X            last expression of <body> is returned.  Each binding of a
  647. X            <variable> has <body> as its region.
  648. X
  649. X            If a name is supplied, a procedure that takes the bound
  650. X            variables as its arguments and has the body of the LET as
  651. X            its body is bound to that name.
  652. X
  653. X        (LET* <bindings> <body>)
  654. X
  655. X            Same as LET except that the bindings are done sequentially
  656. X            from left to right and the bindings to the left are visible
  657. X            while evaluating the initialization expressions for each
  658. X            variable.
  659. X
  660. X        (LETREC <bindings> <body>)
  661. X
  662. X            <Bindings> should have the form
  663. X
  664. X                ((<variable> <init>)...)
  665. X
  666. X            and <body> should be a sequence of one or more expressions.
  667. X            The <variable>s are bound to fresh locations holding
  668. X            undefined values; the <init>s are evaluated in the resulting
  669. X            environment; each <variable>  is assigned to the result of
  670. X            the corresponding <init>; the <body> is evaluated in the
  671. X            resulting environment; and the value of the last expression
  672. X            in <body> is returned.  Each binding of a <variable> has the
  673. X            entire letrec expression as its region, making it possible
  674. X            to define mutually recursive procedures.  One restriction of
  675. X            letrec is very important:  it must be possible to evaluate
  676. X            each <init> without referring to the value of any
  677. X            <variable>.  If this restriction is violated, then the
  678. X            effect is undefined, and an error may be signalled during
  679. X            evaluation of the <init>s.  The restriction is necessary
  680. X            because Scheme passes arguments by value rather than by
  681. X            name.  In the most common uses of letrec, all the <init>s
  682. X            are lambda expressions and the restriction is satisfied
  683. X            automatically.
  684. X
  685. X
  686. X
  687. X
  688. X
  689. X
  690. X
  691. X
  692. X
  693. X
  694. X
  695. X
  696. X        XSCHEME                    SEQUENCING                    Page 11
  697. X
  698. X
  699. X            SEQUENCING
  700. X
  701. X            (BEGIN <expression>...)
  702. X            (SEQUENCE <expression>...)
  703. X
  704. X                The <expression>s are evaluated sequentially from left
  705. X                to right, and the value of the last <expression> is
  706. X                returned.  This expression type is used to sequence side
  707. X                effects such as input and output.
  708. X
  709. X
  710. X
  711. X
  712. X
  713. X
  714. X
  715. X
  716. X
  717. X
  718. X
  719. X
  720. X
  721. X
  722. X
  723. X
  724. X
  725. X
  726. X
  727. X
  728. X
  729. X
  730. X
  731. X
  732. X
  733. X
  734. X
  735. X
  736. X
  737. X
  738. X
  739. X
  740. X
  741. X
  742. X
  743. X
  744. X
  745. X
  746. X
  747. X
  748. X
  749. X
  750. X
  751. X
  752. X
  753. X
  754. X
  755. X
  756. X
  757. X
  758. X
  759. X
  760. X
  761. X
  762. X        XSCHEME                DELAYED EVALUATION                Page 12
  763. X
  764. X
  765. X            DELAYED EVALUATION
  766. X
  767. X            (CONS-STREAM expr1 expr2)
  768. X
  769. X                Create a cons stream whose head is expr1 (which is
  770. X                evaluated immediately) and whose tail is expr2 (whose
  771. X                evaluation is delayed until TAIL is called).  To use
  772. X                CONS-STREAM, enter the following access procedures:
  773. X
  774. X                    (define head car)
  775. X                    (define (tail stream) (force (cdr stream)))
  776. X
  777. X            (DELAY <expression>)
  778. X
  779. X                Evaluating this expression creates a "promise" to
  780. X                evaluate <expression>  at a later time.
  781. X
  782. X            (FORCE promise)
  783. X
  784. X                Applying FORCE to a promise generated by DELAY requests
  785. X                that the promise produce the value of the expression
  786. X                passed to DELAY.  The first time a promise is FORCEed,
  787. X                the DELAY expression is evaluated and the value stored.
  788. X                On subsequent calls to FORCE with the same promise, the
  789. X                saved value is returned.
  790. X
  791. X
  792. X
  793. X
  794. X
  795. X
  796. X
  797. X
  798. X
  799. X
  800. X
  801. X
  802. X
  803. X
  804. X
  805. X
  806. X
  807. X
  808. X
  809. X
  810. X
  811. X
  812. X
  813. X
  814. X
  815. X
  816. X
  817. X
  818. X
  819. X
  820. X
  821. X
  822. X
  823. X
  824. X
  825. X
  826. X
  827. X
  828. X        XSCHEME                    ITERATION                     Page 13
  829. X
  830. X
  831. X            ITERATION
  832. X
  833. X            (WHILE <test> <expression>...)
  834. X
  835. X                While is an iteration construct.  Each iteration begins
  836. X                by evaluating <test>; if the result is false, then the
  837. X                loop terminates and the value of <test> is returned as
  838. X                the value of the while expression.  If <test>  evaluates
  839. X                to a true value, then the <expression>s are evaluated in
  840. X                order for effect and the next iteration begins.
  841. X
  842. X
  843. X
  844. X
  845. X
  846. X
  847. X
  848. X
  849. X
  850. X
  851. X
  852. X
  853. X
  854. X
  855. X
  856. X
  857. X
  858. X
  859. X
  860. X
  861. X
  862. X
  863. X
  864. X
  865. X
  866. X
  867. X
  868. X
  869. X
  870. X
  871. X
  872. X
  873. X
  874. X
  875. X
  876. X
  877. X
  878. X
  879. X
  880. X
  881. X
  882. X
  883. X
  884. X
  885. X
  886. X
  887. X
  888. X
  889. X
  890. X
  891. X
  892. X
  893. X
  894. X        XSCHEME                   DEFINITIONS                    Page 14
  895. X
  896. X
  897. X            DEFINITIONS
  898. X
  899. X            (DEFINE <variable> <expression>)
  900. X
  901. X                Define a variable and give it an initial value.
  902. X
  903. X            (DEFINE (<variable> <formals>) <body>)
  904. X
  905. X                Define a procedure.
  906. X
  907. X
  908. X
  909. X
  910. X
  911. X
  912. X
  913. X
  914. X
  915. X
  916. X
  917. X
  918. X
  919. X
  920. X
  921. X
  922. X
  923. X
  924. X
  925. X
  926. X
  927. X
  928. X
  929. X
  930. X
  931. X
  932. X
  933. X
  934. X
  935. X
  936. X
  937. X
  938. X
  939. X
  940. X
  941. X
  942. X
  943. X
  944. X
  945. X
  946. X
  947. X
  948. X
  949. X
  950. X
  951. X
  952. X
  953. X
  954. X
  955. X
  956. X
  957. X
  958. X
  959. X
  960. X        XSCHEME                  LIST FUNCTIONS                  Page 15
  961. X
  962. X
  963. X            LIST FUNCTIONS
  964. X
  965. X            (CONS expr1 expr2)
  966. X
  967. X                Create a new pair whose car is expr1 and whose cdr is
  968. X                expr2.
  969. X
  970. X            (CAR pair)
  971. X
  972. X                Extract the car of a pair.
  973. X
  974. X            (CDR pair)
  975. X
  976. X                Extract the cdr of a pair.
  977. X
  978. X            (CxxR pair)
  979. X            (CxxxR pair)
  980. X            (CxxxxR pair)
  981. X
  982. X                These functions are short for combinations of CAR and
  983. X                CDR.  Each 'x' is stands for either 'A' or 'D'.  An 'A'
  984. X                stands for the CAR function and a 'D' stands for the CDR
  985. X                function.  For instance, (CADR x) is the same as (CAR
  986. X                (CDR x)).
  987. X
  988. X            (LIST expr...)
  989. X
  990. X                Create a list whose elements are the arguments to the
  991. X                function.  This function can take an arbitrary number of
  992. X                arguments.  Passing no arguments results in the empty
  993. X                list.
  994. X
  995. X            (APPEND list...)
  996. X
  997. X                Append lists to form a single list.  This function takes
  998. X                an arbitrary number of arguments.  Passing no arguments
  999. X                results in the empty list.
  1000. X
  1001. X            (REVERSE list)
  1002. X
  1003. X                Create a list whose elements are the same as the
  1004. X                argument except in reverse order.
  1005. X
  1006. X            (LAST-PAIR list)
  1007. X
  1008. X                Return the last pair in a list.
  1009. X
  1010. X            (LENGTH list)
  1011. X
  1012. X                Compute the length of a list.
  1013. X
  1014. X
  1015. X
  1016. X
  1017. X
  1018. X
  1019. X
  1020. X
  1021. X
  1022. X
  1023. X
  1024. X
  1025. X
  1026. X        XSCHEME                  LIST FUNCTIONS                  Page 16
  1027. X
  1028. X
  1029. X            (MEMBER expr list)
  1030. X            (MEMV expr list)
  1031. X            (MEMQ expr list)
  1032. X
  1033. X                Find an element in a list.  Each of these functions
  1034. X                searches the list looking for an element that matches
  1035. X                expr.  If a matching element is found, the remainder of
  1036. X                the list starting with that element is returned.  If no
  1037. X                matching element is found, the empty list is returned.
  1038. X                The functions differ in the test used to determine if an
  1039. X                element matches expr.  The MEMBER function uses EQUAL?,
  1040. X                the MEMV function uses EQV?  and the MEMQ function uses
  1041. X                EQ?.
  1042. X
  1043. X            (ASSOC expr alist)
  1044. X            (ASSV expr alist)
  1045. X            (ASSQ expr alist)
  1046. X
  1047. X                Find an entry in an association list.  An association
  1048. X                list is a list of pairs.  The car of each pair is the
  1049. X                key and the cdr is the value.  These functions search an
  1050. X                association list for a pair whose key matches expr.  If
  1051. X                a matching pair is found, it is returned.  Otherwise,
  1052. X                the empty list is returned.  The functions differ in the
  1053. X                test used to determine if a key matches expr.  The ASSOC
  1054. X                function uses EQUAL?, the ASSV function uses EQV?  and
  1055. X                the ASSQ function uses EQ?.
  1056. X
  1057. X            (LIST-REF list n)
  1058. X
  1059. X                Return the nth element of a list (zero based).
  1060. X
  1061. X            (LIST-TAIL list n)
  1062. X
  1063. X                Return the sublist obtained by removing the first n
  1064. X                elements of list.
  1065. X
  1066. X
  1067. X
  1068. X
  1069. X
  1070. X
  1071. X
  1072. X
  1073. X
  1074. X
  1075. X
  1076. X
  1077. X
  1078. X
  1079. X
  1080. X
  1081. X
  1082. X
  1083. X
  1084. X
  1085. X
  1086. X
  1087. X
  1088. X
  1089. X
  1090. X
  1091. X
  1092. X        XSCHEME            DESTRUCTIVE LIST FUNCTIONS            Page 17
  1093. X
  1094. X
  1095. X            DESTRUCTIVE LIST FUNCTIONS
  1096. X
  1097. X            (SET-CAR! pair expr)
  1098. X
  1099. X                Set the car of a pair to expr.  The value returned by
  1100. X                this procedure is unspecified.
  1101. X
  1102. X            (SET-CDR! pair expr)
  1103. X
  1104. X                Set the cdr of a pair to expr.  The value returned by
  1105. X                this procedure is unspecified.
  1106. X
  1107. X
  1108. X
  1109. X
  1110. X
  1111. X
  1112. X
  1113. X
  1114. X
  1115. X
  1116. X
  1117. X
  1118. X
  1119. X
  1120. X
  1121. X
  1122. X
  1123. X
  1124. X
  1125. X
  1126. X
  1127. X
  1128. X
  1129. X
  1130. X
  1131. X
  1132. X
  1133. X
  1134. X
  1135. X
  1136. X
  1137. X
  1138. X
  1139. X
  1140. X
  1141. X
  1142. X
  1143. X
  1144. X
  1145. X
  1146. X
  1147. X
  1148. X
  1149. X
  1150. X
  1151. X
  1152. X
  1153. X
  1154. X
  1155. X
  1156. X
  1157. X
  1158. X        XSCHEME                 SYMBOL FUNCTIONS                 Page 18
  1159. X
  1160. X
  1161. X            SYMBOL FUNCTIONS
  1162. X
  1163. X            (BOUND? sym)
  1164. X
  1165. X                Returns #t if a global value is bound to the symbol and
  1166. X                #f otherwise.
  1167. X
  1168. X            (SYMBOL-VALUE sym)
  1169. X
  1170. X                Get the global value of a symbol.
  1171. X
  1172. X            (SET-SYMBOL-VALUE! sym expr)
  1173. X
  1174. X                Set the global value of a symbol.  The value returned by
  1175. X                this procedure is unspecified.
  1176. X
  1177. X            (SYMBOL-PLIST sym)
  1178. X
  1179. X                Get the property list associated with a symbol.
  1180. X
  1181. X            (SET-SYMBOL-PLIST! sym plist)
  1182. X
  1183. X                Set the property list associate with a symbol.  The
  1184. X                value returned by this procedure is unspecified.
  1185. X
  1186. X            (GENSYM [sym|str|num])
  1187. X
  1188. X                Generate a new, uninterned symbol.  The print name of
  1189. X                the symbol will consist of a prefix with a number
  1190. X                appended.  The initial prefix is "G" and the initial
  1191. X                number is 1.  If a symbol is specified as an argument,
  1192. X                the prefix is set to the print name of that symbol.  If
  1193. X                a string is specified, the prefix is set to that string.
  1194. X                If a number is specified, the numeric suffix is set to
  1195. X                that number.  After the symbol is generated, the number
  1196. X                is incremented so subsequent calls to GENSYM will
  1197. X                generate numbers in sequence.
  1198. X
  1199. X            (GET sym prop)
  1200. X
  1201. X                Get the value of a property of a symbol.  The prop
  1202. X                argument is a symbol that is the property name.  If a
  1203. X                property with that name exists on the symbols property
  1204. X                list, the value of the property is returned.  Otherwise,
  1205. X                the empty list is returned.
  1206. X
  1207. X            (PUT sym prop expr)
  1208. X
  1209. X                Set the value of a property of a symbol.  The prop
  1210. X                argument is a symbol that is the property name.  The
  1211. X                property/value combination is added to the property list
  1212. X                of the symbol.
  1213. X
  1214. X
  1215. X
  1216. X
  1217. X
  1218. X
  1219. X
  1220. X
  1221. X
  1222. X
  1223. X
  1224. X        XSCHEME                 VECTOR FUNCTIONS                 Page 19
  1225. X
  1226. X
  1227. X            VECTOR FUNCTIONS
  1228. X
  1229. X            (VECTOR expr...)
  1230. X
  1231. X                Create a vector whose elements are the arguments to the
  1232. X                function.  This function can take an arbitrary number of
  1233. X                arguments.  Passing no arguments results in a zero
  1234. X                length vector.
  1235. X
  1236. X            (MAKE-VECTOR len)
  1237. X
  1238. X                Make a vector of the specified length.
  1239. X
  1240. X            (VECTOR-LENGTH vect)
  1241. X
  1242. X                Get the length of a vector.
  1243. X
  1244. X            (VECTOR-REF vect n)
  1245. X
  1246. X                Return the nth element of a vector (zero based).
  1247. X
  1248. X            (VECTOR-SET! vect n expr)
  1249. X
  1250. X                Set the nth element of a vector (zero based).
  1251. X
  1252. X
  1253. X
  1254. X
  1255. X
  1256. X
  1257. X
  1258. X
  1259. X
  1260. X
  1261. X
  1262. X
  1263. X
  1264. X
  1265. X
  1266. X
  1267. X
  1268. X
  1269. X
  1270. X
  1271. X
  1272. X
  1273. X
  1274. X
  1275. X
  1276. X
  1277. X
  1278. X
  1279. X
  1280. X
  1281. X
  1282. X
  1283. X
  1284. X
  1285. X
  1286. X
  1287. X
  1288. X
  1289. X
  1290. X        XSCHEME                 ARRAY FUNCTIONS                  Page 20
  1291. X
  1292. X
  1293. X            ARRAY FUNCTIONS
  1294. X
  1295. X            (MAKE-ARRAY d1 d2...)
  1296. X
  1297. X                Make an array (vector of vectors) with the specified
  1298. X                dimensions.  At least one dimension must be specified.
  1299. X
  1300. X            (ARRAY-REF array s1 s2...)
  1301. X
  1302. X                Get an array element.  The sn arguments are integer
  1303. X                subscripts (zero based).
  1304. X
  1305. X            (ARRAY-SET! array s1 s2... expr)
  1306. X
  1307. X                Set an array element.  The sn arguments are integer
  1308. X                subscripts (zero based).
  1309. X
  1310. X
  1311. X
  1312. X
  1313. X
  1314. X
  1315. X
  1316. X
  1317. X
  1318. X
  1319. X
  1320. X
  1321. X
  1322. X
  1323. X
  1324. X
  1325. X
  1326. X
  1327. X
  1328. X
  1329. X
  1330. X
  1331. X
  1332. X
  1333. X
  1334. X
  1335. X
  1336. X
  1337. X
  1338. X
  1339. X
  1340. X
  1341. X
  1342. X
  1343. X
  1344. X
  1345. X
  1346. X
  1347. X
  1348. X
  1349. X
  1350. X
  1351. X
  1352. X
  1353. X
  1354. X
  1355. X
  1356. X        XSCHEME               CONVERSION FUNCTIONS               Page 21
  1357. X
  1358. X
  1359. X            CONVERSION FUNCTIONS
  1360. X
  1361. X            (SYMBOL->STRING sym)
  1362. X
  1363. X                Convert a symbol to a string.  Returns the print name of
  1364. X                the symbol as a string.
  1365. X
  1366. X            (STRING->SYMBOL str)
  1367. X
  1368. X                Convert a string to a symbol.  Returns a symbol with the
  1369. X                string as its print name.  This can either be a new
  1370. X                symbol or an existing one with the same print name.
  1371. X
  1372. X            (VECTOR->LIST vect)
  1373. X
  1374. X                Convert a vector to a list.  Returns a list of the
  1375. X                elements of the vector.
  1376. X
  1377. X            (LIST->VECTOR list)
  1378. X
  1379. X                Convert a list to a vector.  Returns a vector of the
  1380. X                elements of the list.
  1381. X
  1382. X            (STRING->LIST str)
  1383. X
  1384. X                Convert a string to a list.  Returns a list of the
  1385. X                characters in the string.
  1386. X
  1387. X            (LIST->STRING list)
  1388. X
  1389. X                Convert a list of character to a string.  Returns a
  1390. X                string whose characters are the elements of the list.
  1391. X
  1392. X            (CHAR->INTEGER char)
  1393. X
  1394. X                Convert a character to an integer.  Returns the ASCII
  1395. X                code of the character as an integer.
  1396. X
  1397. X            (INTEGER->CHAR n)
  1398. X
  1399. X                Convert an integer ASCII code to a character.  Returns
  1400. X                the character whose ASCII code is the integer.
  1401. X
  1402. X
  1403. X
  1404. X
  1405. X
  1406. X
  1407. X
  1408. X
  1409. X
  1410. X
  1411. X
  1412. X
  1413. X
  1414. X
  1415. X
  1416. X
  1417. X
  1418. X
  1419. X
  1420. X
  1421. X
  1422. X        XSCHEME                 TYPE PREDICATES                  Page 22
  1423. X
  1424. X
  1425. X            TYPE PREDICATE FUNCTIONS
  1426. X
  1427. X            (NOT expr)
  1428. X
  1429. X                Returns #t if the expression is #f and #t otherwise.
  1430. X
  1431. X            (NULL? expr)
  1432. X
  1433. X                Returns #t if the expression is the empty list and #f
  1434. X                otherwise.
  1435. X
  1436. X            (ATOM? expr)
  1437. X
  1438. X                Returns #f if the expression is a pair and #t otherwise.
  1439. X
  1440. X            (LIST? expr)
  1441. X
  1442. X                Returns #t if the expression is either a pair or the
  1443. X                empty list and #f otherwise.
  1444. X
  1445. X            (NUMBER? expr)
  1446. X
  1447. X                Returns #t if the expression is a number and #f
  1448. X                otherwise.
  1449. X
  1450. X            (BOOLEAN? expr)
  1451. X
  1452. X                Returns #t if the expression is either #t or #f and #f
  1453. X                otherwise.
  1454. X
  1455. X            (PAIR? expr)
  1456. X
  1457. X                Returns #t if the expression is a pair and #f otherwise.
  1458. X
  1459. X            (SYMBOL? expr)
  1460. X
  1461. X                Returns #t if the expression is a symbol and #f
  1462. X                otherwise.
  1463. X
  1464. X            (COMPLEX? expr)
  1465. X
  1466. X                Returns #t if the expression is a complex number and #f
  1467. X                otherwise.
  1468. X                Note:  Complex numbers are not yet supported by XScheme.
  1469. X
  1470. X            (REAL? expr)
  1471. X
  1472. X                Returns #t if the expression is a real number and #f
  1473. X                otherwise.
  1474. X
  1475. X
  1476. X
  1477. X
  1478. X
  1479. X
  1480. X
  1481. X
  1482. X
  1483. X
  1484. X
  1485. X
  1486. X
  1487. X
  1488. X        XSCHEME                 TYPE PREDICATES                  Page 23
  1489. X
  1490. X
  1491. X            (RATIONAL? expr)
  1492. X
  1493. X                Returns #t if the expression is a rational number and #f
  1494. X                otherwise.
  1495. X                Note:  Rational numbers are not yet supported by
  1496. X                XScheme.
  1497. X
  1498. X            (INTEGER? expr)
  1499. X
  1500. X                Returns #t if the expression is an integer and #f
  1501. X                otherwise.
  1502. X
  1503. X            (CHAR? expr)
  1504. X
  1505. X                Returns #t if the expression is a character and #f
  1506. X                otherwise.
  1507. X
  1508. X            (STRING? expr)
  1509. X
  1510. X                Returns # if the expression is a string and #f
  1511. X                otherwise.
  1512. X
  1513. X            (VECTOR? expr)
  1514. X
  1515. X                Returns #t if the expression is a vector and #f
  1516. X                otherwise.
  1517. X
  1518. X            (PROCEDURE? expr)
  1519. X
  1520. X                Returns #t if the expression is a procedure (closure)
  1521. X                and #f otherwise.
  1522. X
  1523. X            (PORT? expr)
  1524. X
  1525. X                Returns #t if the expression is a port and #f otherwise.
  1526. X
  1527. X            (INPUT-PORT? expr)
  1528. X
  1529. X                Returns #t if the expression is an input port and #f
  1530. X                otherwise.
  1531. X
  1532. X            (OUTPUT-PORT? expr)
  1533. X
  1534. X                Returns #t if the expression is an output port and #f
  1535. X                otherwise.
  1536. X
  1537. X            (OBJECT? expr)
  1538. X
  1539. X                Returns #t if the expression is an object and #f
  1540. X                otherwise.
  1541. X
  1542. X
  1543. X
  1544. X
  1545. X
  1546. X
  1547. X
  1548. X
  1549. X
  1550. X
  1551. X
  1552. X
  1553. X
  1554. X        XSCHEME                 TYPE PREDICATES                  Page 24
  1555. X
  1556. X
  1557. X            (EOF-OBJECT? expr)
  1558. X
  1559. X                Returns #t if the expression is the object returned by
  1560. X                READ upon detecting an end of file condition and #f
  1561. X                otherwise.
  1562. X
  1563. X            (DEFAULT-OBJECT? expr)
  1564. X
  1565. X                Returns #t if the expression is the object passed as the
  1566. X                default value of an optional parameter to a procedure
  1567. X                when that parameter is omitted from a call and #f
  1568. X                otherwise.
  1569. X
  1570. X            (ENVIRONMENT? x)
  1571. X
  1572. X                Returns #t if the expression is an environment and #f
  1573. X                otherwise.
  1574. X
  1575. X
  1576. X
  1577. X
  1578. X
  1579. X
  1580. X
  1581. X
  1582. X
  1583. X
  1584. X
  1585. X
  1586. X
  1587. X
  1588. X
  1589. X
  1590. X
  1591. X
  1592. X
  1593. X
  1594. X
  1595. X
  1596. X
  1597. X
  1598. X
  1599. X
  1600. X
  1601. X
  1602. X
  1603. X
  1604. X
  1605. X
  1606. X
  1607. X
  1608. X
  1609. X
  1610. X
  1611. X
  1612. X
  1613. X
  1614. X
  1615. X
  1616. X
  1617. X
  1618. X
  1619. X
  1620. X        XSCHEME               EQUALITY PREDICATES                Page 25
  1621. X
  1622. X
  1623. X            EQUALITY PREDICATES
  1624. X
  1625. X            (EQUAL? expr1 expr2)
  1626. X
  1627. X                Recursively compares two objects to determine if their
  1628. X                components are the same and returns #t if they are the
  1629. X                same and #f otherwise.
  1630. X
  1631. X            (EQV? expr1 expr2)
  1632. X
  1633. X                Compares two objects to determine if they are the same
  1634. X                object.  Returns #t if they are the same and #f
  1635. X                otherwise.  This function does not compare the elements
  1636. X                of lists, vectors or strings but will compare all types
  1637. X                of numbers.
  1638. X
  1639. X            (EQ? expr1 expr2)
  1640. X
  1641. X                Compares two objects to determine if they are the same
  1642. X                object.  Returns #t if they are the same and #f
  1643. X                otherwise.  This function performs a low level address
  1644. X                compare on two objects and may return #f for objects
  1645. X                that appear on the surface to be the same.  This is
  1646. X                because the objects are not stored uniquely in memory.
  1647. X                For instance, numbers may appear to be equal, but EQ?
  1648. X                will return #f when comparing them if they are stored at
  1649. X                different addresses.  The advantage of this function is
  1650. X                that it is faster than the others.  Symbols are
  1651. X                guaranteed to compare correctly, so EQ? can safely be
  1652. X                used to compare them.
  1653. X
  1654. X
  1655. X
  1656. X
  1657. X
  1658. X
  1659. X
  1660. X
  1661. X
  1662. X
  1663. X
  1664. X
  1665. X
  1666. X
  1667. X
  1668. X
  1669. X
  1670. X
  1671. X
  1672. X
  1673. X
  1674. X
  1675. X
  1676. X
  1677. X
  1678. X
  1679. X
  1680. X
  1681. X
  1682. X
  1683. X
  1684. X
  1685. X
  1686. X        XSCHEME               ARITHMETIC FUNCTIONS               Page 26
  1687. X
  1688. X
  1689. X            ARITHMETIC FUNCTIONS
  1690. X
  1691. X            (ZERO? n)
  1692. X
  1693. X                Returns #t if the number is zero and #f otherwise.
  1694. X
  1695. X            (POSITIVE? n)
  1696. X
  1697. X                Returns #t if the number is positive and #f otherwise.
  1698. X
  1699. X            (NEGATIVE? n)
  1700. X
  1701. X                Returns #t if the number is negative and #f otherwise.
  1702. X
  1703. X            (ODD? n)
  1704. X
  1705. X                Returns #t if the integer is odd and #f otherwise.
  1706. X
  1707. X            (EVEN? n)
  1708. X
  1709. X                Returns #t if the integer is even and #f otherwise.
  1710. X
  1711. X            (EXACT? n)
  1712. X
  1713. X                Returns #t if the number is exact and #f otherwise.
  1714. X                Note:  This function always returns #f in XScheme since
  1715. X                exact numbers are not yet supported.
  1716. X
  1717. X            (INEXACT? n)
  1718. X
  1719. X                Returns #t if the number is inexact and #f otherwise.
  1720. X                Note:  This function always returns #t in XScheme since
  1721. X                exact numbers are not yet supported.
  1722. X
  1723. X            (TRUNCATE n)
  1724. X
  1725. X                Truncates a number to an integer and returns the
  1726. X                resulting value.
  1727. X
  1728. X            (FLOOR n)
  1729. X
  1730. X                Returns the largest integer not larger than n.
  1731. X
  1732. X            (CEILING n)
  1733. X
  1734. X                Returns the smallest integer not smaller than n.
  1735. X
  1736. X            (ROUND n)
  1737. X
  1738. X                Returns the closest integer to n, rounding to even when
  1739. X                n is halfway between two integers.
  1740. X
  1741. X            (1+ n)
  1742. X
  1743. X
  1744. X
  1745. X
  1746. X
  1747. X
  1748. X
  1749. X
  1750. X
  1751. X
  1752. X        XSCHEME               ARITHMETIC FUNCTIONS               Page 27
  1753. X
  1754. X
  1755. X                Returns the result of adding one to the number.
  1756. X
  1757. X            (-1+ n)
  1758. X
  1759. X                Returns the result of subtracting one from the number.
  1760. X
  1761. X            (ABS n)
  1762. X
  1763. X                Returns the absolute value of the number.
  1764. X
  1765. X            (GCD n1 n2)
  1766. X
  1767. X                Returns the greatest common divisor of the two numbers.
  1768. X
  1769. X            (RANDOM n)
  1770. X
  1771. X                Returns a random number between zero and n-1 (n must be
  1772. X                an integer).
  1773. X
  1774. X            (+ n1 n2...)
  1775. X
  1776. X                Returns the sum of the numbers.
  1777. X
  1778. X            (- n)
  1779. X
  1780. X                Negates the number and returns the resulting value.
  1781. X
  1782. X            (- n1 n2...)
  1783. X
  1784. X                Subtracts each remaining number from n1 and returns the
  1785. X                resulting value.
  1786. X
  1787. X            (* n1 n2...)
  1788. X
  1789. X                Multiples the numbers and returns the resulting value.
  1790. X
  1791. X            (/ n)
  1792. X
  1793. X                Returns 1/n.
  1794. X
  1795. X            (/ n1 n2...)
  1796. X
  1797. X                Divides n1 by each of the remaining numbers and returns
  1798. X                the resulting value.
  1799. X
  1800. X            (QUOTIENT n1 n2...)
  1801. X
  1802. X                Divides the integer n1 by each of the remaining numbers
  1803. X                and returns the resulting integer quotient.  This
  1804. X                function does integer division.
  1805. X
  1806. X            (REMAINDER n1 n2)
  1807. X
  1808. X                Divides the integer n1 by the integer n2 and returns the
  1809. X
  1810. X
  1811. X
  1812. X
  1813. X
  1814. X
  1815. X
  1816. X
  1817. X
  1818. X        XSCHEME               ARITHMETIC FUNCTIONS               Page 28
  1819. X
  1820. X
  1821. X                remainder.
  1822. X
  1823. X            (MIN n1 n2...)
  1824. X
  1825. X                Returns the number with the minimum value.
  1826. X
  1827. X            (MAX n1 n2...)
  1828. X
  1829. X                Returns the number with the maximum value.
  1830. X
  1831. X            (SIN n)
  1832. X
  1833. X                Returns the sine of the number.
  1834. X
  1835. X            (COS n)
  1836. X
  1837. X                Returns the cosine of the number.
  1838. X
  1839. X            (TAN n)
  1840. X
  1841. X                Returns the tangent of the number.
  1842. X
  1843. X            (ASIN n)
  1844. X
  1845. X                Returns the arc-sine of the number.
  1846. X
  1847. X            (ACOS n)
  1848. X
  1849. X                Returns the arc-cosine of the number.
  1850. X
  1851. X            (ATAN x)
  1852. X
  1853. X                Returns the arc-tangent of x.
  1854. X
  1855. X            (ATAN y x)
  1856. X
  1857. X                Returns the arc-tangent of y/x.
  1858. X
  1859. X            (EXP n)
  1860. X
  1861. X                Returns e raised to the n.
  1862. X
  1863. X            (SQRT n)
  1864. X
  1865. X                Returns the square root of n.
  1866. X
  1867. X            (EXPT n1 n2)
  1868. X
  1869. X                Returns n1 raised to the n2 power.
  1870. X
  1871. X            (LOG n)
  1872. X
  1873. X                Returns the natural logarithm of n.
  1874. X
  1875. X
  1876. X
  1877. X
  1878. X
  1879. X
  1880. X
  1881. X
  1882. X
  1883. X
  1884. X        XSCHEME           NUMERIC COMPARISON FUNCTIONS           Page 29
  1885. X
  1886. X
  1887. X            NUMERIC COMPARISON FUNCTIONS
  1888. X
  1889. X            (< n1 n2...)
  1890. X            (= n1 n2...)
  1891. X            (> n1 n2...)
  1892. X            <<= n1 n2...)
  1893. X            (>= n1 n2...)
  1894. X
  1895. X                These functions compare numbers and return #t if the
  1896. X                numbers match the predicate and #f otherwise.  For
  1897. X                instance, (< x y z) will return #t if x is less than y
  1898. X                and y is less than z.
  1899. X
  1900. X
  1901. X
  1902. X
  1903. X
  1904. X
  1905. X
  1906. X
  1907. X
  1908. X
  1909. X
  1910. X
  1911. X
  1912. X
  1913. X
  1914. X
  1915. X
  1916. X
  1917. X
  1918. X
  1919. X
  1920. X
  1921. X
  1922. X
  1923. X
  1924. X
  1925. X
  1926. X
  1927. X
  1928. X
  1929. X
  1930. X
  1931. X
  1932. X
  1933. X
  1934. X
  1935. X
  1936. X
  1937. X
  1938. X
  1939. X
  1940. X
  1941. X
  1942. X
  1943. X
  1944. X
  1945. X
  1946. X
  1947. X
  1948. X
  1949. X
  1950. X        XSCHEME            BITWISE LOGICAL FUNCTIONS             Page 30
  1951. X
  1952. X
  1953. X            BITWISE LOGICAL FUNCTIONS
  1954. X
  1955. X            (LOGAND n1 n2...)
  1956. X
  1957. X                Returns the bitwise AND of the integer arguments.
  1958. X
  1959. X            (LOGIOR n1 n2...)
  1960. X
  1961. X                Returns the bitwise inclusive OR of the integer
  1962. X                arguments.
  1963. X
  1964. X            (LOGXOR n1 n2...)
  1965. X
  1966. X                Returns the bitwise exclusive OR of the integer
  1967. X                arguments.
  1968. X
  1969. X            (LOGNOT n)
  1970. X
  1971. X                Returns the bitwise complement of n.
  1972. X
  1973. X
  1974. X
  1975. X
  1976. X
  1977. X
  1978. X
  1979. X
  1980. X
  1981. X
  1982. X
  1983. X
  1984. X
  1985. X
  1986. X
  1987. X
  1988. X
  1989. X
  1990. X
  1991. X
  1992. X
  1993. X
  1994. X
  1995. X
  1996. X
  1997. X
  1998. X
  1999. X
  2000. X
  2001. X
  2002. X
  2003. X
  2004. X
  2005. X
  2006. X
  2007. X
  2008. X
  2009. X
  2010. X
  2011. X
  2012. X
  2013. X
  2014. X
  2015. X
  2016. X        XSCHEME                 STRING FUNCTIONS                 Page 31
  2017. X
  2018. X
  2019. X            STRING FUNCTIONS
  2020. X
  2021. X            (STRING-LENGTH str)
  2022. X
  2023. X                Returns the length of the string.
  2024. X
  2025. X            (STRING-NULL? str)
  2026. X
  2027. X                Returns #t if the string has a length of zero and #f
  2028. X                otherwise.
  2029. X
  2030. X            (STRING-APPEND str1...)
  2031. X
  2032. X                Returns the result of appending the string arguments.
  2033. X                If no arguments are supplied, it returns the null
  2034. X                string.
  2035. X
  2036. X            (STRING-REF str n)
  2037. X
  2038. X                Returns the nth character in a string.
  2039. X
  2040. X            (SUBSTRING str start end)
  2041. X
  2042. X                Returns the substring of str starting at start and
  2043. X                ending at end (integers).  The range is inclusive of
  2044. X                start and exclusive of end.
  2045. X
  2046. X
  2047. X
  2048. X
  2049. X
  2050. X
  2051. X
  2052. X
  2053. X
  2054. X
  2055. X
  2056. X
  2057. X
  2058. X
  2059. X
  2060. X
  2061. X
  2062. X
  2063. X
  2064. X
  2065. X
  2066. X
  2067. X
  2068. X
  2069. X
  2070. X
  2071. X
  2072. X
  2073. X
  2074. X
  2075. X
  2076. X
  2077. X
  2078. X
  2079. X
  2080. X
  2081. X
  2082. X        XSCHEME           STRING COMPARISON FUNCTIONS            Page 32
  2083. X
  2084. X
  2085. X            STRING COMPARISON FUNCTIONS
  2086. X
  2087. X            (STRING<? str1 str2)
  2088. X            (STRING=? str1 str2)
  2089. X            (STRING>? str1 str2)
  2090. X            (STRING<=? str1 str2)
  2091. X            (STRING>=? str1 str2)
  2092. X
  2093. X                These functions compare strings and return #t if the
  2094. X                strings match the predicate and #f otherwise.  For
  2095. X                instance, (STRING< x y) will return #t if x is less than
  2096. X                y.  Case is significant.  #A does not match #a.
  2097. X
  2098. X            (STRING-CI<? str1 str2)
  2099. X            (STRING-CI=? str1 str2)
  2100. X            (STRING-CI>? str1 str2)
  2101. X            (STRING-CI<=? str1 str2)
  2102. X            (STRING-CI>=? str1 str2)
  2103. X
  2104. X                These functions compare strings and return #t if the
  2105. X                strings match the predicate and #f otherwise.  For
  2106. X                instance, (STRING-CI< x y) will return #t if x is less
  2107. X                than y.  Case is not significant.  #A matches #a.
  2108. X
  2109. X
  2110. X
  2111. X
  2112. X
  2113. X
  2114. X
  2115. X
  2116. X
  2117. X
  2118. X
  2119. X
  2120. X
  2121. X
  2122. X
  2123. X
  2124. X
  2125. X
  2126. X
  2127. X
  2128. X
  2129. X
  2130. X
  2131. X
  2132. X
  2133. X
  2134. X
  2135. X
  2136. X
  2137. X
  2138. X
  2139. X
  2140. X
  2141. X
  2142. X
  2143. X
  2144. X
  2145. X
  2146. X
  2147. X
  2148. X        XSCHEME          CHARACTER COMPARISON FUNCTIONS          Page 33
  2149. X
  2150. X
  2151. X            CHARACTER COMPARISON FUNCTIONS
  2152. X
  2153. X            (CHAR<? ch1 ch2)
  2154. X            (CHAR=? ch1 ch2)
  2155. X            (CHAR>? ch1 ch2)
  2156. X            (CHAR<=? ch1 ch2)
  2157. X            (CHAR>=? ch1 ch2)
  2158. X
  2159. X                These functions compare characters and return #t if the
  2160. X                characters match the predicate and #f otherwise.  For
  2161. X                instance, (CHAR< x y) will return #t if x is less than
  2162. X                y.  Case is significant.  #A does not match #a.
  2163. X
  2164. X            (CHAR-CI<? ch1 ch2)
  2165. X            (CHAR-CI=? ch1 ch2)
  2166. X            (CHAR-CI>? ch1 ch2)
  2167. X            (CHAR-CI<=? ch1 ch2)
  2168. X            (CHAR-CI>=? ch1 ch2)
  2169. X
  2170. X                These functions compare characters and return #t if the
  2171. X                characters match the predicate and #f otherwise.  For
  2172. X                instance, (CHAR-CI< x y) will return #t if x is less
  2173. X                than y.  Case is not significant.  #A matchs #a.
  2174. X
  2175. X
  2176. X
  2177. X
  2178. X
  2179. X
  2180. X
  2181. X
  2182. X
  2183. X
  2184. X
  2185. X
  2186. X
  2187. X
  2188. X
  2189. X
  2190. X
  2191. X
  2192. X
  2193. X
  2194. X
  2195. X
  2196. X
  2197. X
  2198. X
  2199. X
  2200. X
  2201. X
  2202. X
  2203. X
  2204. X
  2205. X
  2206. X
  2207. X
  2208. X
  2209. X
  2210. X
  2211. X
  2212. X
  2213. X
  2214. X        XSCHEME              INPUT/OUTPUT FUNCTIONS              Page 34
  2215. X
  2216. X
  2217. X            INPUT/OUTPUT FUNCTIONS
  2218. X
  2219. X            (READ [port])
  2220. X
  2221. X                Reads an expression from the specified port.  If no port
  2222. X                is specified, the current input port is used.  Returns
  2223. X                the expression read or an object that satisfies the
  2224. X                default-object? predicate if it reaches the end of file
  2225. X                on the port.
  2226. X
  2227. X            (READ-CHAR [port])
  2228. X
  2229. X                Reads a character from the specified port.  If no port
  2230. X                is specified, the current input port is used.  Returns
  2231. X                the character read or an object that satisfies the
  2232. X                default-object? predicate if it reaches the end of file
  2233. X                on the port.
  2234. X
  2235. X            (READ-BYTE [port])
  2236. X
  2237. X                Reads a byte from the specified port.  If no port is
  2238. X                specified, the current input port is used.  Returns the
  2239. X                byte read or an object that satisfies the default-
  2240. X                object? predicate if it reaches the end of file on the
  2241. X                port.
  2242. X
  2243. X            (WRITE expr [port])
  2244. X            (PRIN1 expr [port])
  2245. X
  2246. X                Writes an expression to the specified port.  If no port
  2247. X                is specified, the current output port is used.  The
  2248. X                expression is written such that the READ function can
  2249. X                read it back.  This means that strings will be enclosed
  2250. X                in quotes and characters will be printed with #
  2251. X                notation.
  2252. X
  2253. X            (WRITE-CHAR ch [port])
  2254. X
  2255. X                Writes a character to the specified port.  If no port is
  2256. X                specified, the current output port is used.
  2257. X
  2258. X            (WRITE-BYTE ch [port])
  2259. X
  2260. X                Writes a byte to the specified port.  If no port is
  2261. X                specified, the current output port is used.
  2262. X
  2263. X            (DISPLAY expr [port])
  2264. X            (PRINC expr [port])
  2265. X
  2266. X                Writes an expression to the specified port.  If no port
  2267. X                is specified, the current output port is used.  The
  2268. X                expression is written without any quoting characters.
  2269. X                No quotes will appear around strings and characters are
  2270. X                written without the # notation.
  2271. X
  2272. X
  2273. X
  2274. X
  2275. X
  2276. X
  2277. X
  2278. X
  2279. X
  2280. X        XSCHEME              INPUT/OUTPUT FUNCTIONS              Page 35
  2281. X
  2282. X
  2283. X            (NEWLINE [port])
  2284. X
  2285. X                Starts a new line on the specified port.  If no port is
  2286. X                specified, the current output port is used.
  2287. X
  2288. X
  2289. X
  2290. X
  2291. X
  2292. X
  2293. X
  2294. X
  2295. X
  2296. X
  2297. X
  2298. X
  2299. X
  2300. X
  2301. X
  2302. X
  2303. X
  2304. X
  2305. X
  2306. X
  2307. X
  2308. X
  2309. X
  2310. X
  2311. X
  2312. X
  2313. X
  2314. X
  2315. X
  2316. X
  2317. X
  2318. X
  2319. X
  2320. X
  2321. X
  2322. X
  2323. X
  2324. X
  2325. X
  2326. X
  2327. X
  2328. X
  2329. X
  2330. X
  2331. X
  2332. X
  2333. X
  2334. X
  2335. X
  2336. X
  2337. X
  2338. X
  2339. X
  2340. X
  2341. X
  2342. X
  2343. X
  2344. X
  2345. X
  2346. X        XSCHEME             OUTPUT CONTROL FUNCTIONS             Page 36
  2347. X
  2348. X
  2349. X            OUTPUT CONTROL FUNCTIONS
  2350. X
  2351. X            (PRINT-BREADTH [n])
  2352. X
  2353. X                Controls the maximum number of elements of a list that
  2354. X                will be printed.  If n is an integer, the maximum number
  2355. X                is set to n.  If it is #f, the limit is set to infinity.
  2356. X                This is the default.  If n is omitted from the call, the
  2357. X                current value is returned.
  2358. X
  2359. X            (PRINT-DEPTH [n])
  2360. X
  2361. X                Controls the maximum number of levels of a nested list
  2362. X                that will be printed.  If n is an integer, the maximum
  2363. X                number is set to n.  If it is #f, the limit is set to
  2364. X                infinity.  This is the default.  If n is omitted from
  2365. X                the call, the current value is returned.
  2366. X
  2367. X
  2368. X
  2369. X
  2370. X
  2371. X
  2372. X
  2373. X
  2374. X
  2375. X
  2376. X
  2377. X
  2378. X
  2379. X
  2380. X
  2381. X
  2382. X
  2383. X
  2384. X
  2385. X
  2386. X
  2387. X
  2388. X
  2389. X
  2390. X
  2391. X
  2392. X
  2393. X
  2394. X
  2395. X
  2396. X
  2397. X
  2398. X
  2399. X
  2400. X
  2401. X
  2402. X
  2403. X
  2404. X
  2405. X
  2406. X
  2407. X
  2408. X
  2409. X
  2410. X
  2411. X
  2412. X        XSCHEME                FILE I/O FUNCTIONS                Page 37
  2413. X
  2414. X
  2415. X            FILE I/O FUNCTIONS
  2416. X
  2417. X            All four of the following OPEN functions take an optional
  2418. X            argument to indicate that file I/O is to be done in binary
  2419. X            mode.  For binary files, this argument should be the symbol
  2420. X            BINARY.  For text files, the argument can be left out or the
  2421. X            symbol TEXT can be supplied.
  2422. X
  2423. X            (OPEN-INPUT-FILE str ['binary])
  2424. X
  2425. X                Opens the file named by the string and returns an input
  2426. X                port.
  2427. X
  2428. X            (OPEN-OUTPUT-FILE str ['binary])
  2429. X
  2430. X                Creates the file named by the string and returns an
  2431. X                output port.
  2432. X
  2433. X            (OPEN-APPEND-FILE str ['binary])
  2434. X
  2435. X                Opens the file named by the string for appending returns
  2436. X                an output port.
  2437. X
  2438. X            (OPEN-UPDATE-FILE str ['binary])
  2439. X
  2440. X                Opens the file named by the string for input and output
  2441. X                and returns an input/output port.
  2442. X
  2443. X            (GET-FILE-POSITION port)
  2444. X
  2445. X                Returns the current file position as an offset in bytes
  2446. X                from the beginning of the file.
  2447. X
  2448. X            (SET-FILE-POSITION! port offset whence)
  2449. X
  2450. X                Sets the current file position as an offset in bytes
  2451. X                from the beginning of the file (when whence equals 0),
  2452. X                the current file position (when whence equals 1) or the
  2453. X                end of the file (when whence equals 2).  Returns the new
  2454. X                file position as an offset from the start of the file.
  2455. X
  2456. X            (CLOSE-PORT port)
  2457. X
  2458. X                Closes any port.
  2459. X
  2460. X            (CLOSE-INPUT-PORT port)
  2461. X
  2462. X                Closes an input port.
  2463. X
  2464. X            (CLOSE-OUTPUT-PORT port)
  2465. X
  2466. X                Closes an output port.
  2467. X
  2468. X
  2469. X
  2470. X
  2471. X
  2472. X
  2473. X
  2474. X
  2475. X
  2476. X
  2477. X
  2478. X        XSCHEME                FILE I/O FUNCTIONS                Page 38
  2479. X
  2480. X
  2481. X            (CALL-WITH-INPUT-FILE str proc)
  2482. X
  2483. X                Open the file whose name is specifed by str and call
  2484. X                proc passing the resulting input port as an argument.
  2485. X                When proc returns, close the file and return the value
  2486. X                returned by proc as the result.
  2487. X
  2488. X            (CALL-WITH-OUTPUT-FILE str proc)
  2489. X
  2490. X                Create the file whose name is specifed by str and call
  2491. X                proc passing the resulting output port as an argument.
  2492. X                When proc returns, close the file and return the value
  2493. X                returned by proc as the result.
  2494. X
  2495. X            (CURRENT-INPUT-PORT)
  2496. X
  2497. X                Returns the current input port.
  2498. X
  2499. X            (CURRENT-OUTPUT-PORT)
  2500. X
  2501. X                Returns the current output port.
  2502. X
  2503. X
  2504. X
  2505. X
  2506. X
  2507. X
  2508. X
  2509. X
  2510. X
  2511. X
  2512. X
  2513. X
  2514. X
  2515. X
  2516. X
  2517. X
  2518. X
  2519. X
  2520. X
  2521. X
  2522. X
  2523. X
  2524. X
  2525. X
  2526. X
  2527. X
  2528. X
  2529. X
  2530. X
  2531. X
  2532. X
  2533. X
  2534. X
  2535. X
  2536. X
  2537. X
  2538. X
  2539. X
  2540. X
  2541. X
  2542. X
  2543. X
  2544. X        XSCHEME                 CONTROL FEATURES                 Page 39
  2545. X
  2546. X
  2547. X            CONTROL FEATURES
  2548. X
  2549. X            (EVAL expr)
  2550. X
  2551. X                Evaluate the expression in the global environment and
  2552. X                return its value.
  2553. X
  2554. X            (APPLY proc args)
  2555. X
  2556. X                Apply the procedure to the list of arguments and return
  2557. X                the result.
  2558. X
  2559. X            (MAP proc list...)
  2560. X
  2561. X                Apply the procedure to argument lists formed by taking
  2562. X                corresponding elements from each list.  Form a list from
  2563. X                the resulting values and return that list as the result
  2564. X                of the MAP call.
  2565. X
  2566. X            (FOR-EACH fun list...)
  2567. X
  2568. X                Apply the procedure to argument lists formed by taking
  2569. X                corresponding elements from each list.  The values
  2570. X                returned by the procedure applications are discarded.
  2571. X                The value returned by FOR-EACH is unspecified.
  2572. X
  2573. X            (CALL-WITH-CURRENT-CONTINUATION proc)
  2574. X            (CALL/CC proc)
  2575. X
  2576. X                Form an "escape procedure" from the current continuation
  2577. X                and pass it as an argument to proc.  Calling the escape
  2578. X                procedure with a single argument will cause that
  2579. X                argument to be passed to the continuation that was in
  2580. X                effect when the CALL-WITH-CURRENT-CONTINUATION procedure
  2581. X                was called.
  2582. X
  2583. X
  2584. X
  2585. X
  2586. X
  2587. X
  2588. X
  2589. X
  2590. X
  2591. X
  2592. X
  2593. X
  2594. X
  2595. X
  2596. X
  2597. X
  2598. X
  2599. X
  2600. X
  2601. X
  2602. X
  2603. X
  2604. X
  2605. X
  2606. X
  2607. X
  2608. X
  2609. X
  2610. X        XSCHEME              ENVIRONMENT FUNCTIONS               Page 40
  2611. X
  2612. X
  2613. X            ENVIRONMENT FUNCTIONS
  2614. X
  2615. X            (THE-ENVIRONMENT)
  2616. X
  2617. X                Returns the current environment.
  2618. X
  2619. X            (PROCEDURE-ENVIRONMENT proc)
  2620. X
  2621. X                Returns the environment from a procedure closure.
  2622. X
  2623. X            (ENVIRONMENT-BINDINGS env)
  2624. X
  2625. X                Returns an association list corresponding to the top
  2626. X                most frame of the specified environment.
  2627. X
  2628. X            (ENVIRONMENT-PARENT env)
  2629. X
  2630. X                Returns the parent environment of the specified
  2631. X                environment.
  2632. X
  2633. X
  2634. X
  2635. X
  2636. X
  2637. X
  2638. X
  2639. X
  2640. X
  2641. X
  2642. X
  2643. X
  2644. X
  2645. X
  2646. X
  2647. X
  2648. X
  2649. X
  2650. X
  2651. X
  2652. X
  2653. X
  2654. X
  2655. X
  2656. X
  2657. X
  2658. X
  2659. X
  2660. X
  2661. X
  2662. X
  2663. X
  2664. X
  2665. X
  2666. X
  2667. X
  2668. X
  2669. X
  2670. X
  2671. X
  2672. X
  2673. X
  2674. X
  2675. X
  2676. X        XSCHEME                UTILITY FUNCTIONS                 Page 41
  2677. X
  2678. X
  2679. X            UTILITY FUNCTIONS
  2680. X
  2681. X            (LOAD str)
  2682. X
  2683. X                Read and evaluate each expression from the specified
  2684. X                file.
  2685. X
  2686. X            (LOAD-NOISILY str)
  2687. X
  2688. X                Read and evaluate each expression from the specified
  2689. X                file and print the results to the current output port.
  2690. X
  2691. X            (TRANSCRIPT-ON str)
  2692. X
  2693. X                Opens a transcript file with the specified name and
  2694. X                begins logging the interactive session to that file.
  2695. X
  2696. X            (TRANSCRIPT-OFF)
  2697. X
  2698. X                Closes the current transcript file.
  2699. X
  2700. X            (EXIT)
  2701. X
  2702. X                Exits from XScheme back to the operating system.
  2703. X
  2704. X            (GC [ni vi])
  2705. X
  2706. X                Invokes the garbage collector and returns information on
  2707. X                memory usage.  If ni and vi are specified, they must be
  2708. X                integers.  Node and vector space are expanded by those
  2709. X                amounts respectively and no garbage collection is
  2710. X                triggered.  GC returns an array of six values: the
  2711. X                number of calls to the garbage collector, the total
  2712. X                number of nodes, the current number of free nodes, the
  2713. X                number of node segments, the number of vector segments
  2714. X                and the total number of bytes allocated to the heap.
  2715. X
  2716. X            (RESET)
  2717. X
  2718. X                Returns to the top level read/eval/print loop.
  2719. X
  2720. X
  2721. X
  2722. X
  2723. X
  2724. X
  2725. X
  2726. X
  2727. X
  2728. X
  2729. X
  2730. X
  2731. X
  2732. X
  2733. X
  2734. X
  2735. X
  2736. X
  2737. X
  2738. X
  2739. X
  2740. X
  2741. X
  2742. X        XSCHEME                 SYSTEM FUNCTIONS                 Page 42
  2743. X
  2744. X
  2745. X            SYSTEM FUNCTIONS
  2746. X
  2747. X            (%CAR pair)
  2748. X            (%CDR pair)
  2749. X            (%SET-CAR! pair expr)
  2750. X            (%SET-CDR! pair expr)
  2751. X            (%VECTOR-LENGTH vect)
  2752. X            (%VECTOR-REF vect n)
  2753. X            (%VECTOR-SET! vect n expr)
  2754. X
  2755. X                These functions do the same as their counterparts
  2756. X                without the leading '%' character.  The difference is
  2757. X                that they don't check the type of their first argument.
  2758. X                This makes it possible to examine data structures that
  2759. X                have the same internal representation as pairs and
  2760. X                vectors.  It is *very* dangerous to modify objects using
  2761. X                these functions and there is no guarantee that future
  2762. X                releases of XScheme will represent objects in the same
  2763. X                way that the current version does.
  2764. X
  2765. X
  2766. X
  2767. X
  2768. X
  2769. X
  2770. X
  2771. X
  2772. X
  2773. X
  2774. X
  2775. X
  2776. X
  2777. X
  2778. X
  2779. X
  2780. X
  2781. X
  2782. X
  2783. X
  2784. X
  2785. X
  2786. X
  2787. X
  2788. X
  2789. X
  2790. X
  2791. X
  2792. X
  2793. X
  2794. X
  2795. X
  2796. X
  2797. X
  2798. X
  2799. X
  2800. X
  2801. X
  2802. X
  2803. X
  2804. X
  2805. X
  2806. X
  2807. X
  2808. X        XSCHEME              OBJECT REPRESENTATIONS              Page 43
  2809. X
  2810. X
  2811. X                OBJECT REPRESENTATIONS
  2812. X
  2813. X                This version of XScheme uses the following object
  2814. X                representations:
  2815. X
  2816. X                    Closures are represented as pairs.  The car of the
  2817. X                    pair is the compiled function and the cdr of the
  2818. X                    pair is the saved environment.
  2819. X
  2820. X                    Compiled functions are represented as vectors.  The
  2821. X                    element at offset 0 is the bytecode string.  The
  2822. X                    element at offset 1 is the function name.  The
  2823. X                    element at offset 2 is a list of names of the
  2824. X                    function arguments.  The elements at offsets above 2
  2825. X                    are the literals refered to by the compiled
  2826. X                    bytecodes.
  2827. X
  2828. X                    Environments are represented as lists of vectors.
  2829. X                    Each vector is an environment frame.  The element at
  2830. X                    offset 0 is a list of the symbols that are bound in
  2831. X                    that frame.  The symbol values start at offset 1.
  2832. X
  2833. X                    Objects are represented as vectors.  The element at
  2834. X                    offset 0 is the class of the object.  The remaining
  2835. X                    elements are the object's instance variable values.
  2836. X
  2837. X
  2838. X
  2839. X
  2840. X
  2841. X
  2842. X
  2843. X
  2844. X
  2845. X
  2846. X
  2847. X
  2848. X
  2849. X
  2850. X
  2851. X
  2852. X
  2853. X
  2854. X
  2855. X
  2856. X
  2857. X
  2858. X
  2859. X
  2860. X
  2861. X
  2862. X
  2863. X
  2864. X
  2865. X
  2866. X
  2867. X
  2868. X
  2869. X
  2870. X
  2871. END_OF_FILE
  2872. if test 52550 -ne `wc -c <'xscheme.doc'`; then
  2873.     echo shar: \"'xscheme.doc'\" unpacked with wrong size!
  2874. fi
  2875. # end of 'xscheme.doc'
  2876. fi
  2877. echo shar: End of archive 7 \(of 7\).
  2878. cp /dev/null ark7isdone
  2879. MISSING=""
  2880. for I in 1 2 3 4 5 6 7 ; do
  2881.     if test ! -f ark${I}isdone ; then
  2882.     MISSING="${MISSING} ${I}"
  2883.     fi
  2884. done
  2885. if test "${MISSING}" = "" ; then
  2886.     echo You have unpacked all 7 archives.
  2887.     rm -f ark[1-9]isdone
  2888. else
  2889.     echo You still need to unpack the following archives:
  2890.     echo "        " ${MISSING}
  2891. fi
  2892. ##  End of shell archive.
  2893. exit 0
  2894. -- 
  2895. Mail submissions (sources or binaries) to <amiga@cs.odu.edu>.
  2896. Mail comments to the moderator at <amiga-request@cs.odu.edu>.
  2897. Post requests for sources, and general discussion to comp.sys.amiga.
  2898.